﻿using System.Data.Entity;
using Aesha.WoW.Broker.Model;

namespace Aesha.WoW.Broker.Data
{
    internal class BrokerContext : DbContext
    {
        public BrokerContext()
        {
            Database.SetInitializer<BrokerContext>(null);

            Configuration.LazyLoadingEnabled = false;
            Configuration.ProxyCreationEnabled = false;
        }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Configurations.Add(Item.Mapping());
            modelBuilder.Configurations.Add(AuctionListing.Mapping());
            modelBuilder.Configurations.Add(ItemSummary.Mapping());
            modelBuilder.Configurations.Add(ItemClass.Mapping());
            modelBuilder.Configurations.Add(ItemSubClass.Mapping());
        }

        public DbSet<Item> Items { get; set; }
        public DbSet<AuctionListing> CurrentListings { get; set; }
        public DbSet<ItemSummary> SummaryData { get; set; }
        public DbSet<ItemClass> ItemClasses { get; set; }
        public DbSet<ItemSubClass> ItemSubClasses { get; set; }
    }
}
